<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.day240701.entity.Admin" %><%--
  Created by IntelliJ IDEA.
  User: 王文尧
  Date: 2024/7/11
  Time: 21:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <%-- 预存数据 --%>
    <%
        List<Admin> aList = new ArrayList<>();
        aList.add(new Admin(1, "wwy1"));
        aList.add(new Admin(2, "wwy2"));
        aList.add(new Admin(3, "wwy3"));
        aList.add(new Admin(4, "wwy4"));

        request.setAttribute("aList", aList);
    %>
    <%--EL 表达式 怎么显示--%>
    ${aList[0]}<br/>
    ${aList[1]}<br/>
    ${aList[2]}<br/>
    ${aList[3]}<br/>

<%--
跟Java增强for循环类似
for(Admin a : aList)
--%>

<%-- items 要遍历的集合或数组（记得加${}） 否则就是普通的字符串，var 是临时变量名 --%>

<c:forEach var="a" items="${aList}">
    ${a.ANo} - ${a.AName}<br/>
</c:forEach>
</body>
</html>
